//    Copyright (C) Kherty.  All rights reserved.
using System;

namespace OpenLS.Core.Formatting
{
    sealed class DateTimeToken : ClauseFormatToken
    {
        public DateTimeToken(string v)
        {
            Value = v;
        }
        internal override string Code
        {
            get
            {
                if (_forceMinute == null)
                    return Value;
                if (_forceMinute.Value)
                    return Value.ToLower();
                return Value.ToUpper();
            }

        }
        internal bool? _forceMinute;
        internal bool? DatePart
        {
            get
            {
                switch (Value.ToLower()[0])
                {
                    case 'y':
                    case 'd': return true;
                    case 'h':
                    case 's':
                        return false;
                    case 'm': return null;
                    default: throw new NotSupportedException();
                }
            }
        }
        public readonly string Value;

    }
}